package org.travel.api.travel.pojo;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.io.Serializable;
import java.util.Objects;

@Entity
public class Airport implements Serializable {
    private Integer airportId;
    private String airportName;
    private String cityName;

    private Integer cityId;

    @Basic
    @Column(name = "cityId", nullable = false, length = 50)
    public Integer getCityId() {
        return cityId;
    }

    public void setCityId(Integer cityId) {
        this.cityId = cityId;
    }

    @Id
    @Column(name = "airportId", nullable = false)
    public Integer getAirportId() {
        return airportId;
    }

    public void setAirportId(Integer airportId) {
        this.airportId = airportId;
    }

    @Basic
    @Column(name = "airportName", nullable = false, length = 50)
    public String getAirportName() {
        return airportName;
    }

    public void setAirportName(String airportName) {
        this.airportName = airportName;
    }

    @Basic
    @Column(name = "cityName", nullable = false, length = 50)
    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Airport airport = (Airport) o;
        return Objects.equals(airportId, airport.airportId) &&
                Objects.equals(airportName, airport.airportName) &&
                Objects.equals(cityName, airport.cityName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(airportId, airportName, cityName);
    }
}
